package io.renren.modules.generator.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.ProjectFileDao;
import io.renren.modules.generator.entity.ProjectFileEntity;
import io.renren.modules.generator.service.ProjectFileService;


@Service("projectFileService")
public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileDao, ProjectFileEntity> implements ProjectFileService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ProjectFileEntity> page = this.page(
                new Query<ProjectFileEntity>().getPage(params),
                new QueryWrapper<ProjectFileEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<ProjectFileEntity> queryFileList(Integer projectId) {
        QueryWrapper<ProjectFileEntity> wrapper = new QueryWrapper();
        wrapper.eq("project_id", projectId);
        List<ProjectFileEntity> projectFileEntityList = this.baseMapper.selectList(wrapper);
        return projectFileEntityList;
    }

}